package com.tengju.support.domain.model.wx;

import lombok.AllArgsConstructor;
import org.springframework.util.StringUtils;

@AllArgsConstructor
public enum WechatWorkTag {

    LIMIT_ACCESS_TO_OUTSIDE_DEPARTMENTS("limitAccessToOutsideDepartments", "限制访问外部门"),
    ;
    String code;
    String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static WechatWorkTag from(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (WechatWorkTag tag : values()) {
            if (tag.code.equals(code)) {
                return tag;
            }
        }
        return null;
    }

}
